﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TypingG
{
    
   
    public partial class LoginDP : Form
    {
        
        private MainMenu menu = new MainMenu();
        public LoginDP()
        {
            
            InitializeComponent();
            onMenu();
        }


        private void BtnRegis_Click(object sender, EventArgs e)
        {
            RegisDP r = new RegisDP();
            r.ShowDialog();

        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            int index;
            if ((index=SQLServer.CheckLevelAccount(this.tID.Text, this.tPass.Text)) != -1)
            {
                
                MessageBox.Show("Đăng nhập thành công");
                AccInfo.start(index);   //starting.. account in rows[index]
                this.Hide();
                Server s = new Server();
                s.ShowDialog();
            }
            else MessageBox.Show("Sai Gì Chăng .Vui lòng nhập lại");
        }

        private void BtnexitClick(object sender, EventArgs e)
        {
            Application.Exit();
        }
        private void onMenu()
        {
            MenuItem item = new MenuItem("&Quản Lý Hệ Thống DataBase");
            MenuItem itemi1 = new MenuItem("&AdminstratorLogin");
            item.MenuItems.Add(itemi1);
            itemi1.Shortcut = Shortcut.CtrlL;
            menu.MenuItems.Add(item);
            this.Menu = menu;
            itemi1.Click += new EventHandler(itemi1_Click);
        }

        void itemi1_Click(object sender, EventArgs e)
        {
            AdminLogin admin = new AdminLogin();
            admin.ShowDialog();
        }

        private void onLoad(object sender, EventArgs e)
        {
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
        }

       
    }
}
